<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <link href="../css/element.css" rel="stylesheet"/>
    <link href="../css/styleindex.css" rel="stylesheet"/>
    <style>
    .layui-laydate{
      width: 100%!important;
    }.layui-laydate-main{
      width: 100%!important;
    }
    .layui-laydate-content table{
      width: 100%!important;
    }
    </style>
</head>
<body style="background:#EFF0F4;">

  <div class="mui-content">
    <div id="vm" class="x-examok" v-cloak>
      <!--  -->
      <div class="x-trtali-box" id="calali" style="margin:1rem"></div>
      <!--  -->
      <div class="x-pro-list">
        <div class="x-pro-top" v-if="nameuser!=''">值班人:{{nameuser}}</div>
        <div class="x-pro-top" v-else>值班人:无</div>
        <div class="x-wf-hrt"><span class="x-wf-line"></span>计划目标</div>
        <div class="x-pro-row">
          <div class="x-pro-label">计划销售额:</div>
          <div class="x-pro-input">
            {{planmoney}}元
          </div>
        </div>
        <div class="x-pro-row">
          <div class="x-pro-label">预估销售额:</div>
          <div class="x-pro-input">
            {{ifmoney}}元
          </div>
        </div>
        <div class="x-pro-row">
          <div class="x-pro-label">实际销售额:</div>
          <div class="x-pro-input">
            {{nowmoney}}元
          </div>
        </div>
        <div class="x-wf-hrt">其他销售目标</div>
        <div class="x-for-border" v-for="(item,index) in othermoney" :key="item.key">
          <div class="x-pro-row x-pro-rowblock">
            <div class="x-pro-label">目标{{index+1}}:{{item.content}}</div>
            <!-- <div class="x-for-border">
              <div class="x-pro-input">

              </div>
            </div> -->
          </div>
          <div class="x-pro-row x-pro-rowblock">
            <div class="x-pro-label">完成结果</div>
            <div class="x-pro-input">
              {{item.effect}}
            </div>
          </div>
        </div>
      </div>
      <!--  -->
      <div class="x-pro-list">
        <div class="x-wf-hrt"><span class="x-wf-line"></span>追踪工作</div>
        <template>
          <el-table :data="tabledata">
            <el-table-column label="序号" width="50" type="index" fixed></el-table-column>
            <el-table-column label="工作名称" width="" fixed>
              <template slot-scope="scope">
                {{scope.row.title}}
              </template>
            </el-table-column>
            <el-table-column label="达成结果" width="">
              <template slot-scope="scope">
                {{scope.row.effect}}
              </template>
            </el-table-column>
            <el-table-column label="有无改善" width="120">
              <template slot-scope="scope">
                <el-button type="primary" v-if="scope.row.is_ok=='0'" size="mini">未确认</el-button>
                <div v-if="scope.row.is_ok=='1'" size="mini" class="x-text-g">已改善</div>
                <div v-if="scope.row.is_ok=='2'" size="mini" class="x-text-r">未改善</div>
              </template>
            </el-table-column>
          </el-table>
        </template>
      </div>
      <!--  -->
      <div class="x-pro-list">
        <div class="x-wf-hrt"><span class="x-wf-line"></span>待办任务</div>
        <template>
          <el-table :data="tabledatatwo">
            <el-table-column label="序号" width="50" type="index" fixed></el-table-column>
            <el-table-column label="优先级" width="" fixed>
              <template slot-scope="scope">
                {{scope.row.level}}
              </template>
            </el-table-column>
            <el-table-column label="任务名称" width="">
              <template slot-scope="scope">
                {{scope.row.title}}
              </template>
            </el-table-column>
            <el-table-column label="责任人" width="">
              <template slot-scope="scope">
                {{scope.row.username}}
              </template>
            </el-table-column>
            <el-table-column label="完成时间" width="">
              <template slot-scope="scope">
                {{scope.row.times}}
              </template>
            </el-table-column>
            <el-table-column label="是否完成" width="120">
              <template slot-scope="scope">
                <el-button type="primary" v-if="scope.row.is_ok=='0'" size="mini">未确认</el-button>
                <div v-if="scope.row.is_ok=='1'" size="mini" class="x-text-g">已完成</div>
                <div v-if="scope.row.is_ok=='2'" size="mini" class="x-text-r">未完成</div>
              </template>
            </el-table-column>
          </el-table>
        </template>
      </div>
    </div>
  </div>

  <script type="text/javascript" src="../script/vue.js"></script>
  <script type="text/javascript" src="../script/element.js"></script>
  <script type="text/javascript" src="../script/api.js"></script>
  <script type="text/javascript" src="../script/base.js"></script>
  <script type="text/javascript" src="../script/laydate/laydate.js"></script>
	<script>
apiready = function () {
    $api.fixStatusBar($api.byId('header'));


    //
    var vm = new Vue({
      el:'#vm',
      data(){
        return{
          thmonth:'',
          tabledata:[],
          tabledatatwo:[],
          planmoney:'',
          ifmoney:'',
          nowmoney:'',
          othermoney:[],
          finishpro:'',
          nameuser:''

        }
      },
      created:function() {
        var that=this;


      },
      mounted:function(){
        var that=this;
        laydate.render({
          elem: '#calali',
          position: 'static',
          btns:['now'],
          format:'yyyyMMdd',
          // theme:'#058142',
          change:function(value,date){
            console.log(value);
            that.thmonth = value;
            that.getdata()
          }
        });
        //当前月份
        var date = new Date();
        var year = date.getFullYear();
        var month = date.getMonth()+1;
        var day = date.getDate()
        if(month<10){
          month = '' + 0 + month;
        }
        if(day<10){
          day = '' + 0 + day;
        }
        var toMonth = '' + year +  month +  day;
        that.thmonth = toMonth;
        that.getdata()

      },
      methods: {
        //
        getdata:function(){
          let that=this;
          api.ajax({
            url:baseurl+'api/duty/content',
            methods:'get',
            data:{
              values:{
                sec: $api.getStorage('apptoken'),
                date:that.thmonth,
                _ssid:$api.getStorage('jobid')
              }
            }
          },function(ret,err){
            if(ret){
              api.hideProgress();
              console.log(JSON.stringify(ret));
              if(ret.status == 1){
                  if(ret.data.data==''){
                    that.planmoney = 0;
                    that.ifmoney = 0;
                    that.nowmoney = 0;
                  }else{
                    that.planmoney = ret.data.data.plan_sale;
                    that.ifmoney = ret.data.data.rate_sale;
                    that.nowmoney = ret.data.data.real_sale;
                    that.nameuser = ret.data.data.set_username;
                  }

                  // that.finishpro = ret.data.data.finish_content;
                  that.othermoney = ret.data.target;
                  that.tabledata = ret.data.follow;
                  that.tabledatatwo = ret.data.task;


              }else{
                api.toast({
                    msg: ret.msg,
                    duration: 3000,
                    location: 'bottom'
                });
              }
            }else{
              api.hideProgress();
              console.log(JSON.stringify(err));
              api.toast({
                  msg: err.msg,
                  duration: 3000,
                  location: 'bottom'
              });
            }
          })
        },
      }
    })
	}


	</script>
</body>
</html>
